<template>
	<view>
		<view class="head">
			<image src="../../static/shopImage/A.png" mode=""></image>
			<view class="">店铺二维码</view>
			<view class="f32">打印</view>
		</view>
		<view class="qr">
			<view class="name"><image src="../../static/images/20160222123336_2JTwZ.jpeg" mode=""></image></view>
			<text>亦媛店</text>
			<image src="../../static/images/u=376029017,2622921745&fm=26&gp=0.jpg" mode=""></image>
			<view class="txt">
				<view class="">分享好友或</view>
				<view class="bo">保存图片到相册</view>
			</view>
		</view>
		<view class="box">
			<view class="boxLeft" @click="togglePopup('bottom', 'share')">
				<image src="../../static/client/111.png" mode="aspectFit" style="width: 41rpx;height: 44rpx;"></image>
				分享
			</view>
			<view class="boxLeft">
				<image src="../../static/images/333.png" mode="aspectFit" style="width: 44rpx;height: 41rpx;"></image>
				保存图片
			</view>
		</view>
		<!-- 分享导航开始 -->
		<uni-popup ref="showshare" :type="type">
			<view class="uni-share">
				<text class="uni-share-title">选择要分享到的平台</text>
				<view class="uni-share-content">
					<view v-for="(item, index) in bottomData" :key="index" class="uni-share-content-box" @tap="share(item.name)">
						<view class="uni-share-content-image"><image :src="item.icon" class="content-image" mode="widthFix" /></view>
						<text class="uni-share-content-text">{{ item.text }}</text>
					</view>
				</view>
				<text class="uni-share-btn" @click="cancel('share')">取消分享</text>
			</view>
		</uni-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			type: '',
			bottomData: [
				{
					text: '微信',
					icon: '../../static/icon_weixin.png',
					name: 'WXSceneSession'
				},
				{
					text: '微信朋友圈',
					icon: '../../static/icon_friends.png',
					name: 'WXSenceTimeline'
				},
				{
					text: '微信收藏',
					icon: '../../static/icon_collect.png',
					name: 'WXSceneFavorite'
				}
			]
		};
	},
	methods: {
		share(type) {
			uni.share({
				provider: type,
				scene: 'WXSceneSession',
				href: 'http://uniapp.dcloud.io/',
				type: 1,
				summary: '分享成功',
				success: function(res) {
					uni.showToast({
						title: '分享成功',
						icon: 'none'
					});
				},
				fail: function(err) {
					uni.showToast({
						title: '分享失败',
						icon: 'none'
					});
				}
			});
		},
		togglePopup(type, open) {
			switch (type) {
				case 'top':
					this.content = '顶部弹出 popup';
					break;
				case 'bottom':
					this.content = '底部弹出 popup';
					break;
				case '	bottom1':
					this.content = '底部弹出 popup';
					break;
				case 'center':
					break;
			}
			this.type = type;
			this.$nextTick(() => {
				this.$refs['show' + open].open();
			});
		},
		cancel(type) {
			this.$refs['show' + type].close();
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: #249af6;
}
.head {
	background-color: #ffffff;
	display: flex;
	justify-content: space-between;
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 500;
	margin-bottom: 30rpx;
	padding: 60rpx 30rpx 20rpx 30rpx;
	image {
		width: 22rpx;
		height: 39rpx;
	}
}
.qr {
	.txt {
		position: absolute;
		bottom: 91rpx;
		left: 230rpx;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(64, 64, 64, 1);
		text-align: center;
		.bo {
			margin-top: 20rpx;
		}
	}
	text {
		position: absolute;
		top: 76rpx;
		left: 168rpx;
		font-size: 40rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(64, 64, 64, 1);
	}
	.name {
		width: 110rpx;
		height: 110rpx;
		border-radius: 9999rpx;
		position: absolute;
		top: 40rpx;
		left: 30rpx;
		border: 2rpx solid #c0c0c0;
		image {
			border: 2rpx solid #c0c0c0;
			border-radius: 9999rpx;
			width: 110rpx;
			height: 110rpx;
		}
	}
	border-radius: 30rpx;
	width: 690rpx;
	height: 785rpx;
	margin: 0 auto;
	margin-top: 146rpx;
	background: rgba(255, 255, 255, 1);
	position: relative;
	image {
		width: 325rpx;
		height: 325rpx;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}
	.shop {
		padding-top: 94rpx;
		width: 100%;
		text-align: center;
	}
}
.box {
	width: 100%;
	height: 98rpx;
	background-color: #ffffff;
	position: absolute;
	bottom: 0;
	display: flex;
	flex-direction: row;
	align-items: center;

	.boxLeft {
		width: 50%;
		line-height: 96rpx;
		text-align: center;
		font-size: 36rpx;
		color: #333;
		font-family: PingFang SC;
		font-weight: 500;
	}
	image {
		margin-right: 20rpx;
		vertical-align: middle;
	}
}
/* 底部分享 */
.share {
	position: absolute;
	right: 30upx;
	image {
		width: 40upx;
		height: 40upx;
		vertical-align: middle;
	}
}
.uni-share {
	/* #ifndef APP-NVUE */
	display: flex;
	flex-direction: column;
	/* #endif */
	background-color: #fff;
}

.uni-share-title {
	line-height: 60rpx;
	font-size: 30rpx;
	padding: 15rpx 0;
	text-align: center;
	background-color: #eaeff3;
}

.uni-share-content {
	/* #ifndef APP-NVUE */
	display: flex;
	/* #endif */
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: center;
	padding: 15px;
	background-color: #eaeff3;
}

.uni-share-content-box {
	/* #ifndef APP-NVUE */
	display: flex;
	/* #endif */
	flex-direction: column;
	align-items: center;
	width: 200rpx;
}

.uni-share-content-image {
	/* #ifndef APP-NVUE */
	display: flex;
	/* #endif */
	flex-direction: row;
	justify-content: center;
	align-items: center;
	width: 80rpx;
	height: 80rpx;
	overflow: hidden;
}

.content-image {
	width: 60rpx;
	height: 60rpx;
}

.uni-share-content-text {
	font-size: 24rpx;
	color: #333;
	padding-top: 5px;
	padding-bottom: 10px;
}

.uni-share-btn {
	height: 90rpx;
	line-height: 90rpx;
	font-size: 14px;
	border-top-color: #f5f5f5;
	border-top-width: 1px;
	border-top-style: solid;
	text-align: center;
	color: #666;
}
</style>
